---
import { POST_INIT_MESSAGE_START, POST_INIT_MESSAGE_END } from '@features/example-runner/constants';
interface Props {
    pageName: string;
    exampleName: string;
}

const { pageName, exampleName } = Astro.props as Props;
---

<Fragment set:html={POST_INIT_MESSAGE_START} />
<script
    define:vars={{
        pageName,
        exampleName,
    }}
>
    const loadedEvent = {
        type: 'init',
        pageName,
        exampleName,
    };
    window.parent?.postMessage(loadedEvent);
</script>
<Fragment set:html={POST_INIT_MESSAGE_END} />
